<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const properties = [
  "中华园,北京市,公寓",
  "华景苑,上海市,别墅",
  "新城市广场,深圳市,公寓",
  "雅居乐花园,广州市,别墅",
  "恒大城,广州市,公寓",
  "太阳花园,北京市,别墅"
];
console.log(properties.join(',').split(','));

console.log(properties[0]);
console.log(properties[0].split(','));
const newArr=properties.map((item)=>{
    return item.split(',')
})
console.log(newArr);
const partment=properties.filter(function(item){
    return item.includes('公寓')
})
// console.log(partment[0].split(','));
const bieshu=properties.filter(function(item){
    return item.includes('别墅')
})
// console.log(bieshu);
// console.log(partment);
//拿出公寓的
const p=partment.map(function(item){
    return item.split(',')[0]
})
console.log(p);
//拿出别墅的
const b=bieshu.map(function(item){
    return item.split(',')[0]
})
console.log(b);
//公寓和别墅放进一个数组
// const newArr=[]
// newArr.push(p,b)
// console.log(newArr);

const obj={
    公寓:p,
    别墅:b
}
console.log(obj);

    </script>
</body>
</html>